{% extends 'hardware/index.html' %}
{% block title %}Cameras{% endblock %}
{% block content %}
<h1 class="page-header">Cameras</h1>
<div class="table">
  <table class="table table-striped" id="cameras">
    <thead>
      <tr>
      <th>Code</th>
      <th>Type</th>
      <th>Orientation</th>
      <th>Optical Element Groups</th>
      <th>Host</th>
      </tr>
    </thead>
    <tbody>
    {% for camera in object_list %}
      <tr>
        <td><a href="{% url 'camera-detail' pk=camera.pk %}">{{ camera.code }}</a></td>
        <td><a href="{% url 'cameratype-detail' pk=camera.camera_type.pk %}">{{ camera.camera_type }}</a></td>
        <td>{{ camera.orientation }}</td>
        <td>
        {% for optical_element_group in camera.optical_element_groups.all %}
          <div><a href="{% url 'opticalelementgroup-detail' pk=optical_element_group.pk %}">{{ optical_element_group }}</a></div>
        {% endfor %}
        </td>
        <td>{{ camera.host }}</td>
      </tr>
    {% endfor %}
    </tbody>
  </table>
</div>
{% endblock %}
{% block extra_javascript %}
<script type="text/javascript">
  $(document).ready(function(){
    $('#cameras').DataTable({
      "order": [[0, "asc"]]
    })
  })
</script>
{% endblock %}
